/*
 * File: sign_zero_centering.c
 *
 * MATLAB Coder version            : 24.2
 * C/C++ source code generated on  : 2025-05-29 15:13:57
 */

/* Include Files */
#include "sign_zero_centering.h"
#include "mean.h"
#include "rt_nonfinite.h"
#include "sign.h"
#include <emmintrin.h>

/* Function Definitions */
/*
 * Arguments    : const double im[102400]
 *                double imo[102400]
 * Return Type  : void
 */
void sign_zero_centering(const double im[102400], double imo[102400])
{
  double im_mean;
  int i;
  /*  输入:  */
  /*    im : M x N 的 double 矩阵 (灰度图像) */
  /*  输出:  */
  /*    imo: 与输入同大小的 double 矩阵 (零均值化结果) */
  /*  计算均值 (避免嵌套 mean 调用，提高代码生成兼容性) */
  im_mean = mean(im);
  /*  将矩阵展平后计算均值 */
  /*  零均值化 */
  for (i = 0; i <= 102398; i += 2) {
    _mm_storeu_pd(&imo[i],
                  _mm_sub_pd(_mm_loadu_pd(&im[i]), _mm_set1_pd(im_mean)));
  }
  b_sign(imo);
}

/*
 * File trailer for sign_zero_centering.c
 *
 * [EOF]
 */
